#include<iostream>
#include<vector>
#include<set>
#include<string>
using namespace std;

#define forn(i,n) for(int i=0;i<(n);i++)
#define forsn(i,s,n) for(int i=(s);i<(n);i++)
#define iter(it,v) for(typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
typedef vector<int> vint;
typedef pair<int,int> par;
typedef set<par> dia;
typedef vector<dia > fixture;

fixture fixt(vint e){
	int n=e.size();
	if(n==2){dia d; d.insert(par(e[0],e[1])); return fixture(1,d);}
	fixture f(n-1);
	vint e1(n/2); forn(i,n/2) e1[i]=e[i];
	vint e2(n/2); forn(i,n/2) e2[i]=e[i+n/2];
	fixture f1=fixt(e1);
	fixture f2=fixt(e2);
	forn(i,n/2-1){
		//UNION
		dia s=f1[i];
		iter(it,f2[i]){
			s.insert(*it);
		}
		f[i]=s;
	}
	forn(i,n/2){
		dia d;
		forn(j,n/2){
			d.insert(par(e1[j],e2[(j+i)%(n/2)]));
		}
		f[i+n/2-1]=d;
	}
	return f;
}

void prnt(fixture f){
	int d=0;
	iter(it,f){
		cout << "dia " << ++d << ": ";
		iter(d,*it){
			cout << d->first << "-" << d->second << "|";
		}
		cout << endl;
	}
	cout << endl;
}

int main(){
	int cases;
	cin >> cases;
	forn(c,cases){
		int n;
		cin >> n;
		vint v;
		forn(i,n) v.push_back(i);
		prnt(fixt(v));
	}
}
